package file;

import java.io.File;
import java.io.FileFilter;
import java.util.Arrays;

//获取./src/file目录中所有
public class Test2 {
    public static void main(String[] args) {
        File dir = new File("./src/file");
        if (dir.isDirectory()){
            File[] subs = dir.listFiles(new FileFilter() {
                public boolean accept(File pathname) {
                    String name = pathname.getName();
                    return name.startsWith("D");
                }
            });
            for (int i = 0; i < subs.length; i++) {
                System.out.println(subs[i].getName());
            }
        }
    }
}
